﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PAT.Common.Classes.LTS;
using PAT.Common.Classes.ModuleInterface;

namespace PAT.Common.Classes.SemanticModels.DTMC
{
    public abstract class DTMCConfiguration : ConfigurationBase
    {
        public static int DistributionIndex;
        public float Probability;
        public int DisIndex;
        //private string ConfigID;

        //public MDPConfiguration(PCSPProcess p, string e, string hidden, Valuation globalEnv, bool isDataOperation, float probability, int index)
        //{
        //    Probability = probability;
        //    DisIndex = index;
        //    Process = p;
        //    Event = e;
        //    GlobalEnv = globalEnv;
        //    HidenEvent = hidden;
        //    IsDataOperation = isDataOperation;
        //}

        public abstract IEnumerable<DTMCConfiguration> MakeOneMoveLocal();

        //public override ConfigurationBase[] MakeOneMove()
        //{
        //    return MakeOneMoveLocal().ToArray();
        //}


        //public List<PCSPConfiguration> MakeOneMoveLocal()
        //{
        //    DistributionIndex = 0; //reset
        //    List<PCSPConfiguration> list = Process.MoveOneStep(this);

        //    //commented because we always assume that there is atomic event -- those generated by PCASE 
        //    if(SpecificationBase.HasAtomicEvent)
        //    {
        //    List<PCSPConfiguration> returnList = new List<PCSPConfiguration>();
        //    foreach (PCSPConfiguration configuration in list)
        //    {
        //        if (configuration.IsAtomic)
        //        {
        //            returnList.Add(configuration);
        //        }
        //    }

        //    if (returnList.Count > 0)
        //    {
        //        return returnList;
        //    }
        //    }

        //    IsDeadLock = list.Count == 0;
        //    return list;
        //}


        //public override string ToString()
        //{
        //    StringBuilder sb = new StringBuilder();
        //    sb.AppendLine("The process is:");
        //    sb.AppendLine(Process.ToString());
        //    if (!GlobalEnv.IsEmpty())
        //    {
        //        sb.AppendLine();
        //        sb.AppendLine("The environment is:");
        //        sb.AppendLine(GlobalEnv.ToString());
        //    }
        //    return sb.ToString();
        //}

        //public override string GetID()
        //{
        //    if (ConfigID == null)
        //    {
        //        if (GlobalEnv.IsEmpty())
        //        {
        //            ConfigID = Process.ProcessID;
        //        }
        //        else
        //        {
        //            ConfigID = GlobalEnv.GetID(Process.ProcessID);
        //        }
        //    }

        //    //if we can make sure ConfigID is not changed, we can calculate one time only
        //    System.Diagnostics.Debug.Assert(ConfigID == Process.ProcessID || ConfigID == GlobalEnv.GetID(Process.ProcessID));

        //    return ConfigID;
        //}




    }
}
